package com.diligreat.service; 

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.diligreat.domain.Lang;
import com.diligreat.mapper.LangMapper;

/**  
 * @Author Bruce 
 * @Date 2012-11-3
 * @Comments
 */
@Service
public class LangService {

	@Autowired
	private LangMapper langMapper;
	
	public List<Lang> getLangSecStepGroup(){
		return langMapper.getLangSecStepGroup();
	}

	public void addLang(Lang lang) {
		langMapper.insertLang(lang);
	}


	public List<Lang> list() {
		return langMapper.list();
	}

	public Integer updateLang(Lang lang) {
		return langMapper.updateLang(lang);
	}

	public void deleteLang(long id) {
		langMapper.deleteLang(id);
		langMapper.deleteLangByUnderId(id);
	}

	public List<Lang> getRegionList() {
		List<Lang> listRegion = langMapper.getRegionList();
		for (Lang lang : listRegion) {
			List<Lang> langUnder = langMapper.getLangGroupById(lang.getId());
			lang.setUnderlist(langUnder);
		}
		return listRegion;
	}
}
 